home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / disktools / allgemein / bakup / backuprexx / backup.rexx next >
OS/2 REXX Batch file  |  1995-03-09  |  3KB  |  94 lines

  1. /* Backup.REXX - A Tape Backup Scheduler */
  2. /* $VER: Backup.REXX 1.10 (26.12.93) */
  3.  
  4. options results
  5. signal on syntax
  6. signal on error
  7.  
  8. /* Start by running CacheX on the UUCP and Fido drive. They're both filled
  9.    with lots and lots of small files, and accessing them uncached is slow. */
  10.  
  11. address command "run <>nil: sys:System/CacheX device=DH3: buffers=2000"
  12.  
  13. /* Set the commands you will be using on various days for your backup. */
  14.  
  15. /* I use logical devices for backups, just in case I want to do a restore
  16.    without overwriting something already there. */
  17.  
  18. /*
  19. 0:       60M    BootDisk    System disk, rarely changed
  20. 1:      406M    Quantum425    BBS File area, small changes daily
  21. 2:       64M    QuantumLPS    BBS partition, changed daily
  22. 3:      109M    Quantum        UUCP partition, changed daily
  23. 4:      100M    Quantum105    Temp downloads, changed daily
  24. 5:      148M    WrenIII        Additional file area, small changes
  25. 6:    100M    Fidonet        Fido messages area, changed daily
  26. */
  27.  
  28. Level.0 = "tar -cab 120 -f btntape: 0: 1: 2: 3: 6:"    /* 525M tape */
  29. /* Level 0 is a most of system, full backup. Keep this tape for three months. */
  30. Level.1 = "tar -caAb 120 -f btntape: 0: 1: 2: 3: 6:"    /* 250M tape */
  31. /* Level 1 is a most of system, incremental backup. Keep this tape two months. */
  32. Level.2 = "tar -cab 120 -f btntape: 2: 3: 4: 5: 6:"    /* 525M tape */
  33. /* Level 2 is a rest of system, full backup. Keep this tape for three months. */
  34. Level.3 = "tar -caAb 120 -f btntape: 2: 3: 4: 5: 6:"    /* 320M tape */
  35. /* Level 3 is a rest of system, incremental backup. Keep this tape for two months. */
  36. Level.9 = "tar -cAb 120 -f btntape: 2: 3: 6:"        /* 150M tape */
  37. /* Level 9 is the daily incemental backup. Keep this tape for one week. */
  38.  
  39. Table = "-tb 120 -f btntape:"
  40.  
  41. /* Create a Table of Contents for the current tape. */
  42.  
  43. /* Here's the daily schedule for four weeks. */
  44.  
  45. /* Sunday    Monday    Tuesday   Wednesday Thursday  Friday    Saturday   */
  46.  
  47.    Day.1 =0; Day.2 =9; Day.3 =9; Day.4 =9; Day.5 =9; Day.6 =9; Day.7 =9
  48.    Day.8 =2; Day.9 =9; Day.10=9; Day.11=9; Day.12=9; Day.13=9; Day.14=9
  49.    Day.15=1; Day.16=9; Day.17=9; Day.18=9; Day.19=9; Day.20=9; Day.21=9
  50.    Day.22=3; Day.23=9; Day.24=9; Day.25=9; Day.26=9; Day.27=9; Day.28=9
  51.  
  52. /* Determine which day today is */
  53.  
  54. DayOfCent   = Date('C')
  55. WeekOfCent  = DayOfCent % 7
  56. WeekOfMonth = WeekOfCent // 4
  57. DayOfWeek   = (DayOfCent // 7) + 1
  58. Today       = (WeekOfMonth * 7) + DayOfWeek
  59.  
  60. /* Perform the actual backup. */
  61. Level=Day.Today
  62. Command=Level.Level
  63. Address command Command
  64.  
  65. /* Then build a catalog of the contents. */
  66. Command='tar >BBX:Backups/Table.'||Level Table
  67. Address command Command
  68.  
  69. /* Now, shut the CacheX task back off. */
  70. Address command "Status >t:Status.Results"
  71.  
  72. Command = ""
  73.  
  74. Call open(file,'t:Status.Results','R')
  75. do until EOF(file) = 1
  76.    StatString = readln(file)
  77.    if ~(StatString = "") then parse var StatString . ProcessNumber . . . ProcessName
  78.    if upper(ProcessName) = 'SYS:SYSTEM/CACHEX' then do
  79.       ProcessNumber = strip(ProcessNumber,'T',':')
  80.       Command = "Break" ProcessNumber
  81.       end
  82.    end
  83. Call close(file)
  84. if ~(Command = "") then Address command Command
  85.  
  86. exit
  87.  
  88. error:
  89. syntax:
  90. Command = 'Echo >> BBX:Sysop-0.log '||'"'||'Error in Backups, line '||SIGL||'"'
  91. Address command Command
  92.  
  93. exit;
  94.